<template>
  <div class="goods" @click="goToInfo">
    <img :src="good.show.img" alt @load="imgload" />
    <div class="goodsinfo">
      <div>{{ good.title }}</div>
      <div class="pri-fav">
        <span class="price">￥ {{ good.price }}</span>
        <span class="fav">☆ {{ good.cfav }}</span>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  name: "GoodsListItem",
  props: {
    good: {
      type: Object,
      default() {
        return {};
      }
    }
  },
  methods: {
    imgload() {
      this.$bus.$emit("itemimgload");
    },
    goToInfo() {
      // console.log(this.good);
      this.$router.push("/detail/" + this.good.iid);
    }
  }
};
</script>
<style lang="css" scoped>
.goods {
  position: relative;
  width: 46%;
  padding: 3px;
  margin-bottom: 45px;
}
.goods img {
  width: 100%;
  border-radius: 5px;
}
.goodsinfo {
  font-size: 12px;
  position: absolute;
  bottom: -30px;
  left: 0;
  right: 0;
}
.goodsinfo div {
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pri-fav {
  text-align: center;
}
.price {
  color: #ff5777;
  display: inline-block;
  padding-top: 5px;
  padding-right: 10px;
}
</style>
